<template>
	<view>
		<h1 style="font-size: 50rpx;text-align: center;font-weight: bold;">我的房屋</h1>
		<view class="uni-container">
			<uni-table ref="table" :loading="loading">
				<uni-tr>
					<uni-th align="center">小区</uni-th>
					<uni-th align="center">楼栋</uni-th>
					<uni-th align="center">单元</uni-th>
					<uni-th align="center">房间</uni-th>
					<uni-th align="center">日期</uni-th>
					<uni-th align="center">审核状态</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in ownerRoom" :key="index">
					<uni-td align="center">{{ item.zyCommunity.communityName }}</uni-td>
					<uni-td align="center">{{ item.zyBuilding.buildingName }}</uni-td>
					<uni-td align="center">{{ item.zyUnit.unitName }}</uni-td>
					<uni-td align="center">{{ item.zyRoom.roomName }}</uni-td>
					<uni-td align="center">{{ item.createTime.replace("T"," ") }}</uni-td>
					<uni-td align="center" v-if="item.roomStatus=== 'Auditing'">审核中</uni-td>
					<uni-td align="center" v-if="item.roomStatus=== 'Binding'">已绑定</uni-td>
					<uni-td align="center" v-if="item.roomStatus==='Reject'">已拒绝</uni-td>
				</uni-tr>
			</uni-table>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ownerRoom: [],
				loading: false,
			}
		},
		methods: {
			getOwnerRoom() {
				uni.request({
					url: 'wx-owner-room',
					data: {},
					method: 'GET',
					success: (res) => {
						this.ownerRoom = res.data.data;
						this.loading = false
						console.log(this.ownerRoom)
					}
				})
			}
		},
		mounted() {
			this.getOwnerRoom()
		}
	}
</script>

<style>

</style>